package com.xiyu.service.controller.admin.infra.webHook;
import com.xiyu.service.vo.infra.sendCloud.SendCloudReceiveInput;
import jakarta.annotation.security.PermitAll;
import org.apache.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import java.util.*;
import com.xiyu.service.framework.web.web.core.pojo.CommonResult;

import com.xiyu.service.service.infra.webHook.SendCloudService;

@Tag(name = "sendCloud")
@RestController
@RequestMapping("/infra/webhook/send-cloud")
@Validated
public class SendCloudController {

    @Resource
    private SendCloudService sendCloudService;


    @PostMapping(value = "/receive" )
    @Operation(summary = "webhook")
    @PermitAll
    @ResponseBody
    public CommonResult<String> receive(SendCloudReceiveInput inputVO) {
        CommonResult<String> result = CommonResult.success(sendCloudService.receive(inputVO));
        if(Objects.equals(result.getData(), ""))
            result.setCode(HttpStatus.SC_OK).setMsg("成功");
        return result;
    }

}
